<template>
  <div class="wrapper">
    <swiper :options="swiperOption" ref="mySwiper" v-if="showSwiper">
      
      <!-- slides -->
      <swiper-slide v-for="item of list" :key="item.id">
        <img :src="item.imgUrl" />
      </swiper-slide>

      <!-- <swiper-slide>
     <img class="swiper-img" src="http://img1.qunarzz.com/sight/p0/201402/08/3f56a73675e4ee05d9d4198a699f5433.jpg_r_800x800_b4a1037e.jpg">
      </swiper-slide>-->
      <!-- Optional controls -->
      <div class="swiper-pagination" slot="pagination"></div>
      <!-- <div class="swiper-button-prev" slot="button-prev"></div>
      <div class="swiper-button-next" slot="button-next"></div>-->
      <!-- <div class="swiper-scrollbar"   slot="scrollbar"></div> -->
    </swiper>
  </div>
</template>
<script>
export default {
  name: "HomeSwiper",
  props: {
    list: Array
  },
  data: function() {
    
    return {
      swiperOption: {
        pagination: ".swiper-pagination",
        loop: true
      }
      
    }
  },
  computed: {
    showSwiper: function() {
      return this.list.length
    }
  }
};
</script>
<style lang="stylus" scoped>
.wrapper >>>.swiper-pagination-bullet-active {
  background: #fff;
}

.wrapper {
  overflow: hidden;
  width: 100%;
  background: gray;
}

.swiper-img {
  width: 100%, ;
}
</style>